﻿using Abp.Application.Services;
using Abp.Application.Services.Dto;
using Abp.AspNetCore.Mvc.Authorization;
using Abp.Auditing;
using AbpZeroTemplate.Auditing;
using AbpZeroTemplate.Auditing.Dto;
using AbpZeroTemplate.Authorization;
using AbpZeroTemplate.Dto;
using AbpZeroTemplate.Web.Controllers;
using AbpZeroTemplate.Web.Swagger;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

namespace AbpZeroTemplate.Api.Admin.Controllers
{
    /// <summary>审计日志
    /// </summary>
    [Area("Admin")]
    [Route("Admin/AuditLog/[action]")]
    [ApiName("Admin")]
    [DisableAuditing]
    [RemoteService]
    [AbpMvcAuthorize(AppPermissions.Pages_Administration_AuditLogs)]
    public class AuditLogController : AbpZeroTemplateControllerBase
    {
        private readonly IAuditLogAppService _auditLogAppService;
        /// <summary>
        /// </summary>
        public AuditLogController(IAuditLogAppService auditLogAppService)
        {
            _auditLogAppService = auditLogAppService;
        }

        /// <summary>查看审计日志
        /// </summary>
        [HttpGet]
        public async Task<PagedResultDto<AuditLogListDto>> GetAuditLogs(GetAuditLogsInput input)
        {
            return await _auditLogAppService.GetAuditLogs(input);
        }

        /// <summary>导出到Excel
        /// </summary>
        [HttpGet]
        public async Task<FileDto> GetAuditLogsToExcel(GetAuditLogsInput input)
        {
            return await _auditLogAppService.GetAuditLogsToExcel(input);
        }



    }
}
